extends "../cTDM_3/cTDM_3.gd"
func _info():
	pass

func _connect():
	._connect()

func _extInit():
	._extInit()
	chaName = "秘术师"
	lv = 3
	attCoe.atk = 25 / 8.5  / 3
	attCoe.maxHp = 660 / 112.5 / 3
	addCdSkill("mss1",11)
	addSkillTxt("秘术智慧：攻击范围内所有友方附加1层buff[攻击+20点，可叠加]，持续7秒[cd:11秒]")
	addSkillTxt("秘术爆弹：普攻有33%概率发射秘术爆弹，对当前敌人造成3次伤害，每次150%物强的魔法伤害")

var pw1 = 33

func _castCdSkill(id):
	._castCdSkill(id)
	if id == "mss1":
		cst("秘术智慧","000000",position)
		var chas = getAllChas(2)
		for i in chas:
			var x = abs(i.cell.x - cell.x)
			var y = abs(i.cell.y - cell.y)
			if x*x + y*y <= att.atkRan * att.atkRan:
				i.addBuff(BF1.new(1))

class BF1:
	extends Buff
	func _init(lv):
		attInit()
		life = lv * 7
		id = "b_mszh"

	func _upS():
		att.atk = 20 * (int(life/8)+1) * pw

func _onAtkChara(atkinfo):
	._onAtkChara(atkinfo)
	if atkinfo.hitCha != self  && atkinfo.atkType == Chara.AtkType.NORMAL:
		if !sys.rndPer(pw1):return
		cst("秘术爆弹","000000",position)
		var d:Eff = newEff("sk_feiDang",sprcPos)
		d._initFlyCha(atkinfo.hitCha)
		yield(d,"onReach")
		for i in range(3):
			#if !atkinfo.hitCha:return
			hurtChara(atkinfo.hitCha,att.atk*1.5,Chara.HurtType.MGI,Chara.AtkType.SKILL)
